package
{
	import flash.display.Sprite;
	
	import mx.collections.ArrayCollection;
	import mx.controls.DataGrid;

	public class DataGridColorFull extends DataGrid
	{
		public function DataGridColorFull()
		{
		}

		override protected function drawRowBackground(s:Sprite, rowIndex:int,y:Number, height:Number,color:uint, dataIndex:int):void
		{
			var item:Object = (dataProvider as ArrayCollection).getItemAt(dataIndex);
			if(item.hasOwnProperty("color"))
			{
				color = item.color; 
			}
			if(item.hasOwnProperty("STATUS"))
			{
				if(item["STATUS"] == "complete")
				{
					color = 0x00FF00FF;
				}
				if(item["STATUS"] == "important")
				{
					color = 0xFF0000FF;
				}
				if(item["STATUS"] == "billed")
				{
					color = 0xF9F9A0A00D0D;
				}
			}

			super.drawRowBackground(s,rowIndex,y,height,color,dataIndex);
		}		
	}
}